package com.hj.collegetravel.tools;

import lombok.Data;

import java.util.List;

@Data
public class ResultLayui<T> {

    private int code;
    private String msg;
    private T data;
    private long count;

    public ResultLayui(int code, String msg, T data, long count) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        this.count = count;
    }

    public static <T> ResultLayui ok(long count, T data) {
        return new ResultLayui<>(0, "", data, count);
    }

    public static ResultLayui ok(List<?> data) {
        return new ResultLayui<>(0, "", data, data.size());
    }

}
